reesehs_FinalHomeworkCode_03

This zombie is so sad, give them back their hand!
This zombie is so sad, give them back their hand!
library(curl)
## Using libcurl 8.1.2 with LibreSSL/3.3.6
f <- curl("https://raw.githubusercontent.com/fuzzyatelin/fuzzyatelin.github.io/master/AN588_Fall23/zombies.csv") #imports data about zombies
d <- read.csv(f, header = TRUE, sep = ",", stringsAsFactors = FALSE)  #reads data and creates data frame from it
head(d) #returns data frame
##   id first_name last_name gender   height   weight zombies_killed
## 1  1      Sarah    Little Female 62.88951 132.0872              2
## 2  2       Mark    Duncan   Male 67.80277 146.3753              5
## 3  3    Brandon     Perez   Male 72.12908 152.9370              1
## 4  4      Roger   Coleman   Male 66.78484 129.7418              5
## 5  5      Tammy    Powell Female 64.71832 132.4265              4
## 6  6    Anthony     Green   Male 71.24326 152.5246              1
##   years_of_education                           major      age
## 1                  1                medicine/nursing 17.64275
## 2                  3 criminal justice administration 22.58951
## 3                  1                       education 21.91276
## 4                  6                  energy studies 18.19058
## 5                  3                       logistics 21.10399
## 6                  4                  energy studies 21.48355

Question One: Calculate the population mean and standard deviation for each quantitative random variable (height, weight, age, number of zombies killed, and years of education). NOTE: You will not want to use the built in var() and sd() commands as these are for samples.

#height
height <- (d$height) #takes data from the column height in the data from d
height
##    [1] 62.88951 67.80277 72.12908 66.78484 64.71832 71.24326 70.26459 59.82760
##    [9] 68.59963 72.81769 70.66565 71.58093 66.69701 65.88747 65.66306 67.54016
##   [17] 72.23608 62.74435 74.75869 63.17104 62.40083 63.32658 72.78699 68.40552
##   [25] 74.47760 66.21361 64.27576 66.11657 64.64341 69.14401 64.43709 70.99726
##   [33] 70.08847 71.14842 64.69846 70.90143 67.17555 67.53278 69.31778 69.89447
##   [41] 66.14536 68.93246 74.23468 66.90534 66.88320 65.80217 66.14164 64.30928
##   [49] 63.53249 62.32462 67.97952 60.66651 64.15817 62.42483 71.75390 68.30398
##   [57] 62.12425 65.29115 69.04027 70.39867 68.16988 67.60233 63.16399 67.43631
##   [65] 72.98792 66.52924 73.06539 67.05393 67.17319 59.57561 72.29987 69.42492
##   [73] 67.30597 67.91256 64.34378 76.18275 70.21352 67.42280 70.35090 70.90769
##   [81] 64.12364 67.25491 64.19751 70.28444 69.09528 67.54954 74.37837 58.74318
##   [89] 59.74390 70.55803 65.85296 65.04941 72.38118 64.32387 66.92469 69.05417
##   [97] 65.05317 64.79030 69.78052 65.71919 72.30678 71.84207 72.42883 69.14784
##  [105] 69.11815 68.25392 63.71453 66.34735 69.63299 72.42975 69.94287 68.13502
##  [113] 62.73187 72.66829 72.27316 65.53651 65.70558 65.21957 55.62160 69.83051
##  [121] 72.60652 65.54598 68.57151 62.03725 68.81267 70.44371 62.82903 62.17699
##  [129] 70.26668 71.30298 70.09881 68.65588 71.25304 55.69298 69.11031 67.62471
##  [137] 67.35961 67.96384 64.99637 70.34750 65.36311 68.38370 66.16297 62.39202
##  [145] 66.63451 66.76502 65.38845 71.01244 66.16538 68.03566 65.16024 62.61210
##  [153] 60.27461 65.01620 66.70297 72.69807 65.40327 65.18109 68.33511 67.76443
##  [161] 67.70104 75.27081 68.08834 67.33379 69.06732 65.42384 74.04072 73.49551
##  [169] 70.31931 68.29221 66.40247 69.38269 67.14351 65.08253 69.29227 63.63477
##  [177] 62.33876 64.18962 68.29124 69.26646 67.62982 62.32604 68.11586 67.80753
##  [185] 69.68828 66.82291 71.02192 71.49300 70.37832 72.09908 65.61280 64.81685
##  [193] 66.59400 59.70420 68.74930 72.59502 65.65491 69.16849 73.21277 74.67166
##  [201] 63.54681 67.89872 67.77072 65.00593 72.67681 63.49785 64.65742 66.70976
##  [209] 75.45580 66.71065 67.19629 72.04628 63.66584 68.57275 66.95127 68.83637
##  [217] 69.85855 70.65569 64.45048 71.30168 66.85417 67.80250 67.07339 61.35044
##  [225] 66.52197 67.60750 62.94211 64.50872 66.23402 71.47646 63.35430 67.56185
##  [233] 69.95512 69.19429 63.54701 71.40202 77.36758 75.85361 66.54655 67.29899
##  [241] 65.73552 62.54044 69.54820 67.03909 69.02792 72.84720 62.07196 68.82742
##  [249] 65.99565 65.21677 61.59703 66.44662 65.08853 72.42676 64.87548 67.15592
##  [257] 68.89152 73.87656 62.03273 64.71368 57.63606 65.94479 68.63621 70.27466
##  [265] 78.03102 64.15654 71.88558 61.62814 61.77285 67.64806 69.05869 65.32725
##  [273] 62.65719 77.95399 66.65833 64.97681 75.21887 74.59113 62.34640 70.79582
##  [281] 72.58839 68.59139 73.60768 58.13216 58.88539 68.72874 65.25383 73.70542
##  [289] 68.00579 69.87480 65.23508 71.96559 63.77365 63.18053 66.35689 67.95232
##  [297] 62.89158 68.85221 69.91124 71.68438 68.39093 67.78153 68.69576 73.60436
##  [305] 72.15195 68.09022 63.76315 71.24438 64.87039 70.95550 74.90819 60.34227
##  [313] 63.80164 68.98872 65.69532 67.17217 63.00016 62.13360 64.46121 69.47477
##  [321] 55.66449 63.74886 71.48824 67.42625 70.25889 73.62638 71.99679 72.05441
##  [329] 67.08054 67.21994 72.06090 73.47046 67.47215 69.61223 68.16540 74.87625
##  [337] 68.61862 67.32688 71.01284 62.45370 63.59131 71.81617 67.03964 60.63871
##  [345] 56.59750 61.98588 72.39991 71.06841 65.94866 67.06188 64.59859 73.81395
##  [353] 72.10447 69.60391 77.60621 70.42895 68.54200 68.39926 68.70399 62.68424
##  [361] 74.13331 65.60196 71.55670 75.25790 72.95424 63.15647 68.64705 69.90024
##  [369] 73.57948 68.81415 63.92522 62.75796 70.07439 64.57137 70.06512 62.70571
##  [377] 65.08026 67.67221 72.78778 66.03250 60.59620 62.89295 75.30248 63.73806
##  [385] 65.26197 61.94586 64.74608 61.45906 67.04479 64.61437 71.89275 60.32104
##  [393] 65.92204 79.48964 70.38055 72.84810 61.58678 67.40818 71.58885 61.40602
##  [401] 77.89866 70.99103 65.18479 59.56853 69.25323 71.95263 62.96045 71.09236
##  [409] 65.14789 62.48025 70.21358 71.23779 71.99081 63.09504 63.58240 68.40776
##  [417] 63.94389 69.00715 70.09183 60.21609 74.63521 71.95173 66.04845 66.06874
##  [425] 67.17895 68.58895 74.08120 65.72828 75.23595 67.91683 68.26537 73.13875
##  [433] 72.33186 65.84735 80.52980 67.57963 70.72725 56.38850 66.38030 75.70883
##  [441] 70.48223 65.27007 68.67168 72.41608 69.60059 60.28376 72.14192 67.19341
##  [449] 64.90341 63.32991 66.58934 65.78639 65.91163 71.74048 71.72562 62.54020
##  [457] 66.48461 63.84295 67.12636 60.16201 76.52642 59.00067 74.83504 62.73514
##  [465] 74.34293 64.26664 75.18903 70.73679 69.85324 67.72148 62.29205 66.12076
##  [473] 78.36087 70.13980 65.61126 67.13339 62.87171 69.40805 64.11557 76.59291
##  [481] 67.85106 71.38093 54.14948 71.16252 63.59853 62.61599 67.69933 63.07296
##  [489] 58.46348 66.11227 62.33724 72.49922 58.27686 61.16774 66.12288 70.63257
##  [497] 62.59813 63.41696 58.23005 65.35825 60.77654 70.11203 75.56981 72.16500
##  [505] 64.09470 68.01025 61.13972 60.56442 62.33275 64.25954 57.59593 75.86921
##  [513] 74.34413 64.72367 70.75588 70.80695 63.64877 67.32648 68.49669 66.06300
##  [521] 69.92066 67.49037 68.87351 68.73901 73.35391 70.03853 70.25290 68.76254
##  [529] 65.00650 67.39488 69.32048 63.52487 67.26091 66.13919 63.27210 68.67496
##  [537] 73.29541 77.95433 67.00396 62.43483 63.17451 71.72426 75.18322 76.61531
##  [545] 63.19721 69.17446 59.60174 69.25874 71.00842 67.41345 66.49196 63.65083
##  [553] 70.02179 66.39057 67.45583 57.85084 65.43688 66.81614 66.02061 69.07649
##  [561] 67.04842 70.76667 71.97404 65.28047 71.59179 62.50773 69.49730 71.51768
##  [569] 69.60290 61.80359 68.00700 60.67610 68.68642 62.93356 68.91217 72.51684
##  [577] 66.80483 75.65866 69.67852 69.17858 68.11816 64.05988 61.25719 68.37091
##  [585] 64.63448 68.41265 73.02198 65.74474 66.95557 69.54824 63.10196 56.05432
##  [593] 73.23254 64.67734 65.21987 74.42189 63.14829 65.89930 64.33214 62.29126
##  [601] 62.69921 67.94584 65.07314 69.36543 69.53375 70.08365 65.21890 64.06947
##  [609] 73.92739 71.68890 68.41098 71.13276 68.22648 62.92221 59.95642 70.41512
##  [617] 67.32648 62.32428 65.63107 62.51217 69.28285 72.25866 69.46897 63.42365
##  [625] 64.62151 71.56688 67.87680 64.08300 73.84898 63.18823 68.08981 64.06442
##  [633] 70.18293 70.23681 74.69231 69.74712 67.19587 71.29604 65.75668 67.35270
##  [641] 69.91751 69.78112 67.18481 67.23772 67.30731 69.34809 72.07851 65.87925
##  [649] 65.34881 66.52055 63.48668 66.39691 68.02573 59.74804 71.77118 64.72491
##  [657] 67.37213 70.38244 71.94457 69.24513 71.43294 73.73934 69.96347 78.58936
##  [665] 66.06844 68.13148 74.63146 63.59900 72.87188 69.40674 65.79459 71.67543
##  [673] 73.79708 61.37148 69.44316 70.49862 72.84169 68.71661 61.95252 68.15269
##  [681] 72.49018 70.94190 76.87613 66.81429 60.95832 67.44551 62.36085 74.47735
##  [689] 65.77360 70.65835 67.38948 69.78012 66.64708 70.76268 63.38425 67.85470
##  [697] 69.79076 63.25111 58.26887 79.92265 67.38798 67.15039 73.21899 66.63676
##  [705] 68.02251 66.30253 70.17689 70.10855 69.08494 69.93489 60.90024 65.99900
##  [713] 70.14702 66.26057 68.47676 63.27806 65.24568 68.50593 73.81399 72.17272
##  [721] 73.44632 64.61843 72.15582 68.65733 65.68296 66.55435 66.42776 61.78157
##  [729] 72.78263 65.49701 68.09354 68.95874 69.25217 76.07529 70.59265 74.89581
##  [737] 57.05437 64.74725 62.85716 68.09101 71.79126 69.43963 67.51395 67.68777
##  [745] 66.37987 68.18345 71.72428 59.55621 64.45252 65.91209 76.58644 71.61794
##  [753] 68.03470 61.48890 66.13981 60.74299 69.40155 67.45969 66.31343 68.86074
##  [761] 61.31970 64.36401 70.78747 65.15692 58.35161 69.70424 60.87902 66.53144
##  [769] 64.61127 73.29459 66.51151 65.66844 70.88873 63.18440 65.07953 63.16838
##  [777] 67.01884 67.69585 65.41359 66.62536 65.35419 67.69123 70.16329 75.60305
##  [785] 62.32243 71.65349 66.35376 68.08977 74.51423 70.66627 72.39275 69.66302
##  [793] 64.40630 69.28553 70.09081 63.82403 66.62572 59.11617 78.85808 70.46825
##  [801] 69.87253 68.60438 60.36736 66.09620 61.67773 62.67853 72.15756 66.19163
##  [809] 69.61105 64.60695 63.70855 70.64534 70.65781 68.78755 68.44256 70.12632
##  [817] 67.10780 63.99734 70.75748 66.85458 62.61715 66.78995 59.43831 66.71859
##  [825] 63.65938 66.50468 68.71798 68.97372 63.24188 62.95986 66.01576 68.03206
##  [833] 73.76519 62.76865 67.94682 69.35963 65.28277 59.29313 68.23992 66.41866
##  [841] 67.66987 57.71565 69.27720 65.28719 74.55413 67.09539 65.94303 73.21440
##  [849] 74.74845 71.62667 75.73562 76.60479 63.89230 65.03123 70.18705 76.44105
##  [857] 66.90715 66.35267 61.22534 61.89408 64.89323 69.21754 74.42849 73.47592
##  [865] 67.15770 65.89614 67.64617 74.21998 63.50868 78.58725 63.08010 68.84493
##  [873] 63.39950 68.52690 63.32136 70.99158 64.34188 67.27901 68.95607 63.06785
##  [881] 72.82977 63.84095 71.53295 66.04816 65.84293 75.43860 61.72987 67.20623
##  [889] 66.27632 67.47719 69.38556 62.97159 70.38518 65.52792 63.65600 65.10541
##  [897] 66.83162 69.87416 67.03323 71.02901 73.57915 74.70658 64.79635 65.17877
##  [905] 67.31721 67.92429 71.62983 71.11957 62.20613 68.75039 65.79126 68.94033
##  [913] 72.48247 78.52778 61.33734 67.77419 69.75290 69.42668 62.82085 65.95360
##  [921] 69.45476 64.65432 67.43870 72.60485 68.75643 79.51505 63.68960 71.69323
##  [929] 64.18578 63.24096 75.19044 59.80658 67.89424 63.23416 65.41633 63.35129
##  [937] 65.37115 64.01953 69.12379 69.77392 60.16256 64.67957 64.09073 67.54747
##  [945] 59.46942 62.79975 64.38058 70.19100 65.18042 67.29623 77.45735 60.87037
##  [953] 61.02291 78.76891 67.06186 75.37067 73.68643 62.06469 62.53065 78.86801
##  [961] 67.06533 63.60624 66.41046 66.32615 74.16976 71.31852 68.70509 67.89409
##  [969] 64.40456 60.32218 68.42884 69.71188 59.14821 74.45980 71.27114 66.02102
##  [977] 77.33672 64.73728 74.58400 64.19924 66.64354 69.80803 65.07139 61.04618
##  [985] 72.37050 72.14352 71.62507 62.79189 63.85283 65.12383 68.19738 67.73069
##  [993] 66.82539 67.93869 73.02337 59.74530 66.48566 69.85086 66.64840 73.62401
mh <- mean(height) #takes the mean of the height data
mh
## [1] 67.6301
sqrt(sum((height - mean(height))^2)/length(height)) #calculates the standard deviation of height data
## [1] 4.30797
#weight
weight <- (d$weight)
weight
##    [1] 132.08717 146.37529 152.93702 129.74180 132.42649 152.52458 160.25690
##    [8] 108.80931 152.90155 168.56164 149.28336 157.35396 133.64411 131.53363
##   [15] 121.28334 143.90609 171.02347 127.11449 145.54679 123.21773 120.79496
##   [22] 129.71493 160.78260 151.49559 163.64636 147.58913 122.73587 128.03177
##   [29] 135.92544 149.17756 134.94510 158.82775 168.28755 167.40555 143.58785
##   [36] 142.73196 149.53860 147.95051 150.37242 167.48617 149.30082 144.96333
##   [43] 200.72519 132.55185 124.59445 139.41537 142.93677 143.92004 135.50657
##   [50] 120.78901 151.08872 103.64309 127.11001 140.52503 158.99550 154.16275
##   [57] 120.61412 127.04585 159.69505 144.28622 148.75251 145.23084 126.60909
##   [64] 153.63340 154.54522 153.96188 176.78868 138.76923 137.09791 106.90385
##   [71] 168.09464 148.18216 152.90825 140.22323 135.90400 156.85281 157.77598
##   [78] 155.74578 158.27175 165.94231 136.03959 138.28812 127.90719 149.56369
##   [85] 162.66789 142.31497 171.01940 109.61112 118.61620 162.39507 145.23135
##   [92] 149.88038 172.65398 116.80429 138.42219 155.82205 133.12870 139.49974
##   [99] 162.17361 116.47640 164.54988 141.45296 149.35858 143.73112 168.80911
##  [106] 151.15346 134.63487 140.14908 140.85628 160.83564 133.82793 154.77022
##  [113] 125.87781 176.66871 142.80879 137.96617 141.96405 143.48528 104.46731
##  [120] 149.97908 154.88139 138.83169 147.50556 130.80562 122.72659 171.20021
##  [127] 127.73019 125.13290 154.67464 165.48850 157.73488 146.44219 178.58517
##  [134] 114.15500 141.72902 146.41595 138.66806 133.76167 127.48816 172.62249
##  [141] 143.34146 137.40639 146.67834 107.85280 138.53987 144.87884 138.13994
##  [148] 173.42680 133.46736 142.30863 137.78717 122.90843 118.43181 141.28974
##  [155] 137.68068 140.65221 136.30243 140.94470 155.58681 134.74878 143.17541
##  [162] 167.36271 141.39260 139.52740 140.75832 125.76590 164.62574 166.46102
##  [169] 143.80713 143.98426 121.81633 140.27244 125.26830 113.53578 168.34796
##  [176] 139.20272 133.55353 143.45538 140.69356 154.98893 139.42856 116.24576
##  [183] 154.09811 151.62669 166.58984 119.43159 141.79841 162.21258 130.53907
##  [190] 181.70385 139.02594 136.76233 138.28322 111.49075 147.61040 155.70413
##  [197] 141.31220 154.57143 160.29477 176.90675 113.26981 154.90117 151.72187
##  [204] 129.49971 161.18564 128.37587 129.57559 151.71140 175.50418 130.71635
##  [211] 125.56477 157.08764 127.32018 136.14083 151.76066 156.99055 149.53798
##  [218] 140.05055 126.80759 141.56979 138.16634 142.84911 128.01368 120.34255
##  [225] 150.72729 141.59998 132.06772 124.10798 150.89742 153.10698 118.54603
##  [232] 146.03713 148.94890 149.24289 145.41724 149.17613 191.08173 188.92512
##  [239] 121.89117 145.72193 131.27131 148.95060 136.00112 152.55135 142.75193
##  [246] 177.69080 137.01400 174.83397 139.85364 128.06537 120.52631 128.23482
##  [253] 128.83160 169.08691 116.45998 129.47204 154.12422 142.57103 135.30925
##  [260] 130.98123 115.97451 127.19803 158.85202 137.87587 172.43516 139.76274
##  [267] 150.30660 119.09149 133.87403 130.51633 143.32588 132.53775 148.31962
##  [274] 162.87909 136.00719 122.30617 176.94569 183.04972 117.57860 143.30825
##  [281] 147.14515 148.59105 171.54063 110.88692 113.67640 167.53775 134.12832
##  [288] 163.59185 133.00251 156.26924 134.28578 159.33558 120.22865 127.10172
##  [295] 143.09937 146.44388 134.33905 150.72621 145.73890 157.69028 167.30731
##  [302] 128.18377 140.66635 161.14736 142.86388 142.85116 127.86502 165.00622
##  [309] 123.63996 155.37249 166.71056 114.51684 126.55416 144.03453 123.41739
##  [316] 143.83208 131.84784 119.56843 129.85802 156.71838 104.32025 131.53597
##  [323] 153.94991 161.51725 146.41676 162.01327 172.63108 146.83509 135.56005
##  [330] 162.92052 153.28237 158.79343 126.47733 160.05929 152.72359 173.03457
##  [337] 139.12086 134.00572 140.21849 134.88586 139.81347 161.12228 138.88308
##  [344] 137.89919 118.04779 134.54128 181.80519 155.76127 145.49633 141.78547
##  [351] 132.52707 171.56118 168.92029 148.10047 182.07925 134.47353 144.70809
##  [358] 150.46193 148.51320 125.08439 163.15454 126.58763 139.10953 181.87341
##  [365] 170.34860 125.82783 139.18612 155.61573 142.39637 141.30445 135.00456
##  [372] 109.69863 147.30885 135.04480 153.46593 125.61392 155.55169 136.64281
##  [379] 161.00599 137.34537 124.33490 120.61751 180.56301 135.99406 148.26509
##  [386] 113.94000 148.56487 128.25544 126.09380 126.87729 162.35142 113.00907
##  [393] 144.38672 162.36966 156.76997 147.55624 132.18938 143.76827 150.78733
##  [400] 116.97247 189.52857 152.96564 141.49123 101.46641 145.23000 150.55786
##  [407] 127.81594 159.16052 143.49534 114.89881 164.51225 164.38534 161.16384
##  [414] 117.97261 141.43774 171.16707 137.47155 149.72943 151.43026 116.92006
##  [421] 173.61426 177.40893 139.65063 124.79954 145.10020 139.30160 158.57634
##  [428] 130.13086 184.39385 150.65150 136.98530 183.59331 167.90658 143.38313
##  [435] 187.46915 137.03408 143.51356 111.98087 130.42275 193.58966 169.93551
##  [442] 129.93437 126.63190 159.61377 130.07927 100.63526 142.67519 147.47040
##  [449] 132.83709 134.36885 126.21003 134.56712 128.16619 137.51776 157.60480
##  [456] 127.72179 125.22667 120.13718 145.29109 117.80138 157.74587 105.30837
##  [463] 157.00465 114.07319 174.25799 140.33744 175.92909 152.01455 150.46243
##  [470] 160.31774 144.93937 134.58624 181.65973 141.29868 118.18610 136.79511
##  [477] 115.00124 154.24447 121.84962 175.42115 133.76997 167.43163  91.40652
##  [484] 176.57354 130.96464 120.11116 114.82681 127.41965  93.75313 128.59654
##  [491] 119.99203 166.81576  90.29148 111.50248 129.21237 158.84458 134.50238
##  [498] 129.20918 123.69592 163.62383 123.45938 159.70616 180.02237 167.39724
##  [505] 123.52875 156.11513 122.69441 116.36554 134.04908 124.10659  97.74513
##  [512] 181.72092 164.48874 146.50127 146.87357 160.93505 133.94672 141.91594
##  [519] 158.31624 139.62567 167.00176 148.97427 138.79673 141.85866 187.17118
##  [526] 148.96486 165.13507 158.15055 138.96235 133.69633 140.03806 125.03381
##  [533] 152.00115 133.46844 108.88332 144.59744 143.90140 174.23256 161.99114
##  [540] 112.09829 157.18907 165.53502 157.96656 170.62537 106.39948 137.92089
##  [547] 103.54306 150.90862 154.60905 142.07735 132.53770 130.28715 172.21130
##  [554] 132.35222 141.60975 102.91278 131.64311 138.33082 139.23583 148.07287
##  [561] 157.80615 169.66641 162.16287 138.23267 173.95092 137.48831 126.70119
##  [568] 168.65008 166.51136 116.83611 132.53965 125.97453 136.46895 125.84274
##  [575] 151.66082 167.17403 141.56430 181.84549 149.99209 138.77007 136.47944
##  [582] 135.85600 117.33374 161.80092 124.38080 154.56367 160.72832 126.91840
##  [589] 148.62328 156.53394 135.10144 104.04000 166.97594 120.67193 124.31422
##  [596] 165.50436 106.46425 137.15483 132.17689 131.67590 120.44256 174.66253
##  [603] 137.98210 151.01650 155.27477 142.61299 131.30382 124.19243 154.16720
##  [610] 170.21915 167.17393 161.57121 157.32702 135.64142 107.19292 181.55666
##  [617] 145.18820 125.16333 140.27636 117.46986 154.18753 173.64377 136.55417
##  [624] 131.40851 120.70336 149.57878 127.57143 123.50983 159.35615 117.52061
##  [631] 151.22476 129.27232 151.62634 138.08073 169.12591 143.65219 144.88678
##  [638] 149.07452 133.50723 147.30635 166.37512 149.18194 163.19775 152.04665
##  [645] 154.07038 151.56207 148.85490 141.18698 146.84062 135.87821 126.57430
##  [652] 135.31829 149.68486 132.64262 154.98836 126.42826 157.92724 142.92167
##  [659] 158.19213 139.59607 168.99074 180.11730 151.89915 169.33868 141.39449
##  [666] 149.84863 150.81086 131.69080 132.31343 138.86455 134.80154 161.78810
##  [673] 163.07583 120.61523 147.79889 148.51031 150.67420 145.93645 139.96105
##  [680] 155.58587 154.35665 173.38288 171.24476 128.38709 131.89548 133.67453
##  [687] 136.69035 156.02408 129.84006 157.54872 149.45754 142.12967 134.52281
##  [694] 151.72600 129.10971 141.78658 157.61016 136.30470 105.67513 210.78951
##  [701] 146.03004 137.46238 170.91212 133.38346 171.46143 144.55691 156.20201
##  [708] 145.24247 158.64966 167.42579 106.43585 139.36660 150.86003 158.50503
##  [715] 162.65288 141.76153 150.66455 139.81028 159.54985 152.59982 165.27980
##  [722] 133.60968 157.45853 149.59080 150.59041 129.90255 137.18396 139.11983
##  [729] 149.96738 133.69320 143.07207 157.74171 144.81515 179.48473 146.11818
##  [736] 162.19754 107.75373 134.32414 115.41856 138.76819 144.24183 145.73272
##  [743] 132.20994 148.83663 143.07932 155.71133 158.32848 108.64047 126.17796
##  [750] 148.35829 172.07034 167.69694 143.64156 117.76796 125.83486 124.34532
##  [757] 137.10640 146.12025 133.84925 161.90558 136.35083 136.98643 154.78083
##  [764] 137.07284 114.96800 162.22363 119.45350 129.02404 129.48488 167.13598
##  [771] 123.86885 132.65296 162.98858 135.80979 167.50179 133.46958 135.65244
##  [778] 143.82660 147.80453 135.30723 131.42581 127.57637 141.88486 172.57784
##  [785] 118.50360 166.43216 131.49805 150.96237 166.90466 149.08637 147.05636
##  [792] 168.66747 113.91252 146.17149 160.16241 119.66493 145.17684 113.94211
##  [799] 157.33281 142.68420 144.12300 134.60961 118.89911 127.49361 111.50505
##  [806] 136.84454 174.64011 133.41318 144.95601 139.51360 133.07476 142.91934
##  [813] 158.05911 173.46517 141.50020 151.22559 163.51092 120.47632 152.39946
##  [820] 135.32605 122.41861 146.16634 117.55640 167.52902 134.61274 139.71832
##  [827] 133.85647 155.61246 128.42484 139.12629 140.06814 142.22447 177.28011
##  [834] 121.77325 158.82218 133.10182 141.17675 120.40272 128.35779 140.70974
##  [841] 152.86718 116.12103 156.32159 130.70999 154.51164 146.78311 147.71596
##  [848] 164.97566 169.67391 156.84291 164.85474 182.14998 130.67732 155.73433
##  [855] 164.39177 172.98846 141.27476 144.78923  93.67081 136.45083 121.91323
##  [862] 156.82454 168.89342 173.75409 138.85684 123.43659 147.72489 157.35376
##  [869] 130.93967 205.18571 125.51564 138.42961 134.40143 126.82070 128.44998
##  [876] 160.79555 129.12935 148.57545 152.13606 114.54661 170.38827 137.00266
##  [883] 156.25616 138.20546 130.18451 179.38231 130.40283 143.04214 132.90110
##  [890] 146.83256 151.64707 130.97597 166.12592 132.66827 128.62922 135.56276
##  [897] 167.13578 169.42002 144.11752 163.03750 157.01912 161.20812 132.88469
##  [904] 131.57993 150.35793 152.57921 181.70307 149.64878 132.56755 150.37530
##  [911] 125.88222 152.65648 165.90306 180.98471 110.12268 137.15192 155.12437
##  [918] 156.11329 119.57916 131.24237 143.53758 121.68864 137.21564 185.79615
##  [925] 142.29780 182.60669 132.82394 155.41503 118.64723 132.84797 172.01948
##  [932]  98.99585 124.29840 147.17445 137.30637 138.53016 147.00777 123.31891
##  [939] 134.34869 174.35023 112.51524 134.25566 132.40476 134.30655 101.47804
##  [946] 118.00840 131.22689 160.54231 145.31085 147.18906 187.03455 111.43301
##  [953] 135.68666 152.59857 151.70980 172.87344 180.86742 137.50644 131.51672
##  [960] 190.20046 144.62453 134.09399 143.81212 140.20367 163.04451 153.11335
##  [967] 151.27165 159.25523 137.10780 104.58108 150.94247 147.55190 112.26983
##  [974] 151.94280 153.78716 149.16463 169.76997 133.36407 172.52736 135.25343
##  [981] 139.03638 143.78952 136.19753 105.68380 169.97828 159.93592 157.09219
##  [988] 128.84268 144.18966 130.01734 156.98666 136.51393 139.88912 159.85200
##  [995] 163.29739 127.14444 157.08778 166.96002 135.51948 178.87686
mw <- mean(weight)
mw
## [1] 143.9075
sqrt(sum((weight - mean(weight))^2)/length(weight))
## [1] 18.39186
#age
age <- (d$age)
age
##    [1] 17.64275 22.58951 21.91276 18.19058 21.10399 21.48355 20.53096 15.94527
##    [9] 17.34933 21.50798 24.15861 20.24794 18.59929 19.21670 20.90986 19.85983
##   [17] 18.74897 19.58134 23.96539 21.80445 23.94054 21.33236 20.94383 21.69196
##   [25] 23.90185 18.82527 21.07451 18.61007 17.74222 23.76366 19.71057 20.34347
##   [33] 18.67233 19.55997 18.13684 23.98011 18.74854 19.53526 22.46561 20.40242
##   [41] 20.78455 21.29583 18.78722 19.62351 20.91053 18.84754 18.50065 16.55924
##   [49] 17.98520 20.29619 20.11017 21.27616 15.77083 18.29770 21.85695 20.93828
##   [57] 21.14685 20.24615 21.72433 23.30563 22.02548 19.97048 16.78669 20.94671
##   [65] 19.81533 16.40678 19.18354 20.42068 20.81643 18.27473 23.23299 22.42172
##   [73] 16.31905 20.77667 14.54944 23.76757 21.02118 15.12527 21.09164 21.73021
##   [81] 14.51158 21.80380 18.27359 23.24532 15.59753 16.51842 22.32466 16.47283
##   [89] 18.34268 21.93253 16.74418 15.18804 22.40936 17.08913 18.03707 18.83810
##   [97] 19.49133 19.76865 25.83258 21.30046 21.90889 24.15091 19.63072 23.16582
##  [105] 18.42327 19.94330 17.04051 20.57695 24.14089 23.77863 24.81298 15.47891
##  [113] 18.84435 19.19078 25.35665 15.39994 18.62090 18.81568 11.13065 21.72714
##  [121] 23.07676 19.82105 18.72847 18.18119 24.91812 20.42065 19.73793 16.89253
##  [129] 20.24323 20.64774 19.59913 21.65333 17.35896 13.67605 22.21023 21.64968
##  [137] 21.92487 20.58336 19.74454 18.99893 15.65899 21.94233 19.22057 19.48839
##  [145] 17.68275 21.72252 19.50424 16.91701 19.08007 24.00246 20.55057 20.65740
##  [153] 15.49664 19.37270 21.30124 24.56925 19.88921 19.55108 17.36646 22.49060
##  [161] 22.76151 23.28328 19.57079 20.65624 21.46047 20.87972 22.26990 22.67476
##  [169] 27.40790 22.19918 22.70490 25.74573 19.43071 19.06514 17.94813 18.15222
##  [177] 14.61176 17.94359 19.18691 23.67717 18.61704 19.90482 20.04527 22.37782
##  [185] 17.94201 23.78604 21.56207 19.91412 27.16777 16.96297 19.07924 16.95885
##  [193] 19.58831 18.40326 16.50640 20.81649 20.29870 18.13150 20.03504 23.83751
##  [201] 19.01969 20.37958 21.22370 21.94580 20.02906 17.64131 19.03575 17.64006
##  [209] 23.86443 20.79042 18.40984 21.30337 20.57065 20.20310 17.17253 21.44259
##  [217] 18.18100 27.14205 17.55099 21.48753 20.26560 16.74823 22.22479 18.31888
##  [225] 19.50909 16.52151 19.70532 23.53162 19.19267 22.35030 21.93743 21.13508
##  [233] 20.57423 22.91233 16.53939 21.04541 24.56507 24.17555 22.39316 17.96663
##  [241] 23.26286 13.49798 26.57689 19.59841 23.00981 20.00607 14.97051 20.27556
##  [249] 19.65585 20.23090 19.59815 22.09547 20.00628 19.04590 23.94809 22.51602
##  [257] 20.67606 24.19646 17.67434 22.95047 12.29306 18.89775 19.17136 21.62270
##  [265] 23.93911 19.38947 21.43525 16.02056 17.90380 25.58631 19.68915 24.03706
##  [273] 18.50000 25.77720 23.09951 20.30056 22.35990 20.23903 17.71510 22.42920
##  [281] 22.37798 18.86332 23.19955 16.98641 16.40110 18.91888 17.46600 20.28010
##  [289] 21.71987 17.92773 19.60105 17.99647 20.49434 24.37250 15.89285 16.75516
##  [297] 14.64070 19.26587 22.08628 26.25881 16.51631 25.39256 22.69690 23.85202
##  [305] 18.88307 22.43699 18.94310 20.16242 19.91682 19.88286 20.84978 17.17613
##  [313] 17.32117 19.82662 20.38294 21.95709 16.87172 17.10722 17.50802 22.57393
##  [321] 10.66381 18.75647 19.67347 17.94266 25.23058 25.36748 21.04131 26.52334
##  [329] 24.13606 16.32740 23.51740 21.68922 20.61760 18.82747 20.03842 23.68478
##  [337] 25.79394 23.35168 25.09822 16.58295 17.20335 20.35923 20.93191 15.44328
##  [345] 12.84805 18.23469 19.13033 23.90774 20.08662 18.54973 21.93930 22.20658
##  [353] 22.25385 19.17092 22.74342 23.05967 18.95085 20.92563 20.30216 20.10654
##  [361] 22.03960 21.64507 27.55380 22.57844 20.93505 16.93500 22.18075 22.19631
##  [369] 23.72008 22.60645 19.19879 20.29005 18.59596 19.85122 19.24231 14.30110
##  [377] 15.81956 22.96536 24.30698 16.91755 15.60612 16.37984 25.17245 17.82412
##  [385] 18.42167 17.34202 17.34365 17.07809 20.71384 16.69059 20.32666 16.16114
##  [393] 16.71908 26.11363 19.89555 24.01948 16.19753 21.42912 21.46295 20.89453
##  [401] 25.82848 22.89693 18.63669 16.53850 23.40428 21.97145 17.96900 18.58929
##  [409] 19.84517 17.55393 22.57096 21.42676 20.09721 18.87523 15.33620 18.61760
##  [417] 13.12491 22.30810 19.74585 13.45451 21.95207 21.32535 18.67405 18.66175
##  [425] 20.28953 21.32987 27.21710 17.24751 22.23308 19.16099 21.89009 22.57573
##  [433] 17.09044 23.23767 27.55264 19.74716 19.52649 12.55466 23.76154 21.56992
##  [441] 18.95161 18.99999 25.67877 20.99180 22.85132 19.77744 27.96693 19.05617
##  [449] 19.24091 17.49842 21.59101 17.96982 18.05536 25.45554 19.30345 17.31055
##  [457] 22.82317 19.11892 21.98378 16.08058 27.68187 16.80293 21.22975 17.90379
##  [465] 19.68748 15.96942 22.48088 18.45236 20.02986 18.90300 17.35418 20.51588
##  [473] 25.33842 23.16894 22.24737 19.83741 19.73186 21.21939 20.00833 23.83629
##  [481] 19.73364 21.31904 14.44936 21.80337 16.95475 19.74367 24.70782 19.08275
##  [489] 16.19003 19.09397 16.78826 20.69956 21.24646 18.80625 21.54377 21.65099
##  [497] 16.19529 19.63817 13.51241 14.39070 12.54540 20.07750 20.82915 21.88073
##  [505] 16.64088 20.20789 19.16468 16.50589 19.52327 22.34368 15.90951 23.43548
##  [513] 25.03579 15.64708 24.73534 17.96941 17.13706 22.39601 16.22865 19.87794
##  [521] 18.82258 21.65255 20.69022 23.88692 20.43760 24.70151 18.77472 22.06032
##  [529] 17.95097 22.55124 24.53695 20.60540 17.67847 17.92167 22.00580 21.57631
##  [537] 24.26479 25.49342 15.82410 18.06575 17.79204 18.09670 22.83459 24.62446
##  [545] 19.63260 21.03526 21.12570 18.65582 17.96210 16.57199 22.04910 21.85049
##  [553] 18.12094 18.61992 19.67025 18.20332 18.23895 15.22140 21.32324 18.94046
##  [561] 20.40624 21.12729 23.82158 21.66344 22.99593 12.80807 22.99975 21.40550
##  [569] 17.09370 16.74787 20.38227 16.74267 24.98712 18.56088 21.16006 22.14217
##  [577] 19.33480 24.46873 19.76354 22.01716 19.24192 17.52440 16.27959 16.46003
##  [585] 19.60460 19.20258 22.56667 19.78770 18.15902 19.19737 15.55708 14.15051
##  [593] 20.84825 17.58633 22.52837 20.75837 21.91993 19.75386 20.64070 17.63057
##  [601] 16.60652 15.36702 14.91156 18.36293 21.97010 20.46354 21.58286 14.84844
##  [609] 23.10560 20.98622 19.44685 16.10785 18.58842 16.20101 14.49622 18.26226
##  [617] 21.73786 17.56003 16.64580 18.57976 19.03215 22.03788 25.11161 17.07766
##  [625] 17.31604 21.82043 24.68390 18.92719 23.12811 19.66843 20.43418 18.18894
##  [633] 19.30563 21.48940 23.55994 20.39527 19.15587 23.97528 22.15048 19.38432
##  [641] 23.17759 24.24839 18.15892 19.29292 18.54005 19.55934 25.05183 16.17854
##  [649] 20.35543 16.85585 20.32650 17.93602 21.40160 15.43728 21.46526 16.54507
##  [657] 20.22591 25.69748 22.77554 22.71537 19.43605 23.15592 18.23132 27.58828
##  [665] 19.81336 20.98309 29.17945 15.30735 23.76093 28.38916 18.73178 23.89309
##  [673] 26.21565 19.63089 21.90481 23.09233 26.71144 21.71346 16.62255 18.32146
##  [681] 22.14767 18.55274 25.29221 25.32669 12.50085 20.11386 15.01671 22.63063
##  [689] 19.92577 24.14823 19.98677 18.35593 24.03626 23.75443 16.39569 20.05336
##  [697] 21.35953 16.32636 16.65884 23.22829 19.64791 20.71514 21.74664 19.53898
##  [705] 19.02552 18.54410 19.56704 22.62593 18.67945 20.14602 20.86981 17.60724
##  [713] 19.66669 17.36132 16.00533 13.87055 17.00379 20.36977 27.37130 25.57398
##  [721] 21.61978 14.64805 22.29698 21.26049 18.19573 20.11425 20.22738 16.38548
##  [729] 20.63110 22.05847 20.03671 21.93762 18.04177 20.90615 20.37872 19.63954
##  [737] 12.74472 18.00704 17.15758 21.28245 28.04978 18.16853 21.91309 22.60577
##  [745] 18.49051 18.30679 21.83863 17.93216 19.40937 21.57588 25.86179 20.76580
##  [753] 19.89604 18.99540 22.98415 16.33405 26.37661 22.55533 20.70579 18.52872
##  [761] 15.20000 13.76439 19.91919 14.99672 15.23501 17.81768 13.91051 21.33672
##  [769] 15.87418 27.55674 21.10963 19.54634 18.37246 14.87000 14.90775 17.85399
##  [777] 22.43070 16.83191 17.77898 15.75510 20.15367 23.33047 26.13428 23.82513
##  [785] 16.10004 18.54976 23.80758 17.07576 25.42632 20.48590 24.09405 19.29941
##  [793] 18.06166 21.03052 16.55408 21.72521 15.99839 15.41400 29.59488 19.45614
##  [801] 23.42488 25.10323 14.77489 21.56388 21.66693 15.76811 21.91014 21.16551
##  [809] 21.90370 14.95027 17.38376 21.71185 20.97237 17.86783 20.35920 19.97787
##  [817] 15.55524 17.79963 21.43846 19.73227 19.11045 18.92234 14.39826 13.88697
##  [825] 17.38705 19.13214 16.11394 20.66009 18.85515 18.73167 17.95568 22.94810
##  [833] 22.34703 16.80661 17.42398 23.25794 20.29679 15.81591 19.92937 21.11497
##  [841] 19.58388 14.23326 20.44759 19.73937 23.19870 18.79596 16.62209 17.44240
##  [849] 20.92256 21.73474 24.00647 27.59225 18.06279 16.70843 21.84500 23.49016
##  [857] 21.76792 20.68250 21.06841 18.31499 20.91683 18.52306 21.98328 23.20071
##  [865] 20.33517 19.75214 24.01972 23.90511 19.73432 24.32751 17.68825 24.00616
##  [873] 17.77331 20.92753 16.98715 18.47655 19.18535 18.35525 22.93477 18.62427
##  [881] 20.70497 17.01380 18.94045 18.84481 21.61323 21.13069 13.43069 19.07113
##  [889] 18.39359 21.32136 18.98611 15.12176 20.86853 19.61513 17.93957 20.66810
##  [897] 16.81380 18.99324 19.37227 21.10780 22.99733 20.93726 18.43727 22.04171
##  [905] 20.44886 18.73962 19.36259 20.58510 17.69093 20.91836 18.53755 20.66301
##  [913] 24.77217 25.82221 18.02149 17.53711 19.43681 19.17863 19.43190 22.94084
##  [921] 20.94367 18.78445 23.06967 22.86708 22.09731 24.85453 17.06348 20.49921
##  [929] 19.69154 16.69606 23.11572 16.95601 22.84620 14.21540 18.93918 17.88162
##  [937] 18.55335 18.66627 21.68061 14.89299 15.53169 18.93974 19.89808 19.87259
##  [945] 19.43739 18.87269 14.98345 23.41001 17.36378 18.31203 23.84402 15.70235
##  [953] 16.84876 29.44928 17.95730 22.91800 21.58449 17.19527 15.66170 23.80738
##  [961] 21.35860 17.11389 20.89564 18.62456 23.24972 18.28638 22.86259 18.51140
##  [969] 16.71759 18.61261 19.22270 20.03009 17.89542 25.21851 16.56274 18.51631
##  [977] 25.62498 20.11204 23.25645 21.61279 20.95489 22.20665 17.53114 19.27299
##  [985] 23.27623 25.10403 20.40505 17.96941 17.21145 18.62649 20.63164 23.61626
##  [993] 19.19450 21.54530 22.12544 14.07024 19.87402 19.42444 19.62096 16.15942
ma <- mean(age)
ma
## [1] 20.04696
sqrt(sum((age - mean(age))^2)/length(age))
## [1] 2.963583
#number of zombies killed
zk <- (d$zombies_killed)
zk
##    [1]  2  5  1  5  4  1  0  4  9  2  4  4  2  5  4  2  5  3  2  1  3  1  0  3
##   [25]  8  1  1  1  4  1  1  1  3  2  5  3  8  1  3  8  7  7  7  1  3  2  7  2
##   [49]  2  6  6  2  1  1  3  7  3  5  6  3  4  3  1  1  4  3  1  1  1  3  2  4
##   [73]  3  4  2  3  3  0  4  1  1  2  4  3  3  4  6  2  2  3  5  4  9  3  4  1
##   [97]  2  2  2  5  3  3  0  3  4  4  3  1  5  6  3  5  3  2  6  3  2  2  2  4
##  [121]  1  4  3  1  3  4  5  5  2  3  2  6  3  5  4  1  1  3  2  1  3  4  4  7
##  [145]  5  1  0  3  3  2  1  0  5  3  3  1  2  4  4  4  5  2  2  5  5  3  6  6
##  [169]  2  4  2  4  5  3  3  4  3  2  3  4  2  4  1  2  4  3  2  5  4  1  1  4
##  [193]  5  3  2  6  4  2  0  1  6  3  2  5  2  4  6  4  4  2  1  4  4  7  5  2
##  [217]  0  2  2  4  5  2  3  2  3  3  0  1  0  3  2  2  4  6  4  4  1  3  3  5
##  [241]  2  2  3  3  3  4  3  1  3  3  2  7  1  0  2  5  4  3  7  1  4  1  0  3
##  [265]  5  3  3  3  8  2  3  2  2  3  3  3  3  7  6  2  4  3  1  3  1  6  2  6
##  [289]  4  0  1  3  2  1  3  6  2  6  5  4  3  0  1  3  1  1  4  2  2  4  2  2
##  [313]  5  2  5  3  3  2  0  2  3  3  1  4  2  3  3  4  1  6  4  2  6  2  1  2
##  [337]  3  5  4  9  1  2  1  3  8  5  2  3  3  1  4  2  1  2  2  2  4  2  4  1
##  [361]  4  2  2  6  3  2  2  1  4  2  1  5  1  0  2  0  2  5  5  2  2  2  0  3
##  [385]  3  3  1  8  3  1  5  4  2  1  3  4  0  2  1  6  1  6  1  5  5  4  5  2
##  [409]  4  4  5  1  1  2  2  2  1  1  6  5  6  7  4  3  5  3  3  2  5  0  2  1
##  [433]  3  3  3  4  3  3  2  1  2  3  2  0  1  3  2  1  2  2  2  4  2  6  3  2
##  [457]  3  3  3  0  7  3  2  3  3  4  2  3  3  0  2  0  2  5  3  2  1  3  3  5
##  [481]  2  3  4  4  4  3  4  3  6  6  3  0  1  1  1  8  3  1  3  1  4  0  2  3
##  [505]  4  1  3  4  3  1  4  4  6  1  2  2  2  6  0  4  0  3  5  0  2  2  3  5
##  [529]  7  3  2  2  0  4  3  4  0  4  2  3  1  0  2  3  4  3  4  3  2  3  0  1
##  [553]  6  5  3  4  2  3  3  2  0  4  1  2  1  5  6  5  3  2  2  4  3  2  3  2
##  [577]  2  3  1  4  1  3  0  4  3  3  2  2  2  3  6  6  6  4  5  6  2  2  5  1
##  [601]  4  4  3  1  2  2  2  3  1  3  2  5  3  2  4  2  1  2  3  3  4  3  2  2
##  [625]  9  2  3  2  3  3  6  4  1  2  0  1  1  8  4  2  4  1  3  2  3  0  3  1
##  [649]  6  3  4  1  2  2  5  4  2  5  3  5  6  1  4  2  0  1  5  4  2  3  2  5
##  [673]  3  3  1  1  4  1  2  3  5  1  4  3  4  3  5  3  7  2  5  1  0  6  3  5
##  [697]  1  4  3  1  1  4  3  2  3  1  5  3  2  2  3  3  7  3  6  6  5  2  4  5
##  [721]  4  2  1  1  3  4  2  3  2  4  6  1  4  3  1  5  1  4  2  4  2  5  3  3
##  [745]  6  2  5  6  3  4  5  2  2  6  4  2  4  6  3  4  3  2  2  6  3  2  3  6
##  [769]  3  1  8  3  4  5  3  3  4  3  5  5  5  1  3  3  1  2  2  3  3  3  3  0
##  [793]  3  3  5  2  1  3  7  5  3  2  2  5  5  2  2  1  2  4  3  8  4  1  3  4
##  [817]  0  2  3  1  3  1  4  1  7  3  3  2  1  1  0  3  1  2  4  3  2  3  2  4
##  [841]  2  6  1  5  2  2  5  2  4  1  4  0  3  2  3  1  1  1  2  1  3  2  5  1
##  [865]  5  3  3  3  2  6  3  3  5  1  1  4  1  1  6  3  4  2  1  2  1  2  2  4
##  [889]  1  6  2  1  3  2 11  3  2  5  2  2  4  3  2  4  6  3  3  0  6  3  3  7
##  [913]  6  4  3  4  3  3  2  2  3  2  1  5  5  1  3  2  6  3  2  3  5  3  1  3
##  [937]  2  1  2  3  4  3  5  2  5  2  5  2  5  1  0  2  2  2  3  1  4  3  2  3
##  [961]  4  3  2  3  3  0  4  4  3  5  0  1  2  2  4  1  3  5  3  3  5  5  2  1
##  [985]  3  2  4  4  1  6  1  3  4  1  3  2  3  5  3  4
mzk <- mean(zk)
mzk
## [1] 2.992
sqrt(sum((zk - mean(zk))^2)/length(zk))
## [1] 1.747551
#years of education
yoedu <- (d$years_of_education)
yoedu
##    [1] 1 3 1 6 3 4 4 0 3 3 4 3 1 5 5 2 1 5 1 5 1 2 5 3 0 3 2 2 2 1 1 0 2 2 4 2 4
##   [38] 3 3 6 3 4 2 3 1 3 1 1 7 2 2 0 3 0 4 3 4 2 6 1 2 2 3 3 0 1 3 4 2 3 3 2 2 5
##   [75] 2 3 5 2 2 2 1 2 4 6 3 2 4 3 5 3 3 1 4 3 4 3 1 2 1 2 7 3 2 5 3 6 2 0 5 1 2
##  [112] 1 3 3 1 1 3 4 1 2 4 3 3 1 4 5 3 2 3 1 2 6 1 3 1 6 4 2 3 3 2 4 1 2 4 2 1 2
##  [149] 8 5 3 2 1 1 2 2 3 0 2 4 1 1 2 2 2 2 3 4 4 5 5 4 3 2 6 7 1 2 1 4 3 5 4 5 2
##  [186] 1 1 3 0 4 1 0 2 3 5 4 3 4 1 0 0 2 2 3 2 2 3 4 3 1 3 3 0 4 4 3 7 2 4 3 5 1
##  [223] 4 3 4 6 6 1 3 4 5 4 1 2 4 1 3 4 2 3 3 1 1 2 2 0 3 2 4 5 4 4 3 6 4 3 1 2 4
##  [260] 3 1 2 2 3 4 0 3 3 2 2 3 3 3 2 5 4 2 4 1 7 3 3 0 4 5 7 3 4 3 3 2 1 3 5 1 3
##  [297] 2 4 2 5 4 4 1 3 4 1 1 0 4 4 3 3 0 1 4 2 5 5 2 5 2 6 3 3 2 3 3 6 1 3 1 1 2
##  [334] 3 2 1 6 3 7 1 4 8 2 3 1 2 6 3 0 6 4 7 7 2 2 4 3 1 2 3 6 1 6 5 3 3 2 2 3 5
##  [371] 1 1 5 3 5 3 2 4 4 1 3 5 5 1 1 3 4 1 1 4 5 3 2 4 3 1 5 3 2 3 3 6 0 3 1 2 2
##  [408] 3 2 2 0 2 8 2 3 1 3 5 2 5 3 4 0 4 0 3 5 1 2 6 3 5 2 3 3 2 2 4 5 0 2 6 3 3
##  [445] 2 5 3 1 2 3 1 3 3 4 1 3 1 6 5 5 4 3 4 5 3 3 7 4 3 4 2 2 4 6 3 2 1 4 5 4 3
##  [482] 3 1 1 4 3 3 2 7 1 2 2 4 0 2 2 2 1 3 4 4 3 1 3 2 4 6 5 5 2 2 2 2 4 2 2 0 6
##  [519] 5 7 2 3 2 4 3 3 6 0 4 4 2 1 7 2 6 2 5 4 2 2 3 6 4 2 0 3 3 1 5 5 5 5 3 3 5
##  [556] 4 4 0 3 4 2 1 4 2 2 4 1 1 2 1 2 2 0 2 2 1 2 7 2 4 4 5 5 2 5 3 3 1 1 1 4 1
##  [593] 5 3 4 3 0 3 6 1 3 2 2 1 0 6 3 5 2 1 5 4 4 0 1 3 3 7 1 3 2 4 5 3 2 5 4 1 2
##  [630] 2 0 2 2 5 7 3 2 2 6 0 3 2 2 1 2 1 2 7 4 3 3 5 6 2 4 4 2 5 1 5 2 5 2 4 2 4
##  [667] 5 2 2 4 3 5 5 2 4 6 2 5 3 4 4 1 4 6 2 5 1 7 2 1 1 3 3 3 4 2 1 2 4 5 3 3 1
##  [704] 2 6 2 5 5 2 3 5 3 2 1 3 5 0 3 3 6 3 6 3 2 1 2 2 3 3 2 4 3 2 2 5 4 5 2 4 3
##  [741] 0 1 0 5 3 4 1 4 3 4 4 4 3 0 0 2 4 5 4 2 5 4 1 2 2 2 3 1 4 4 1 2 1 4 4 5 3
##  [778] 2 4 1 3 4 0 4 3 2 3 2 4 7 6 4 6 1 3 2 2 4 2 3 3 3 1 4 2 2 7 1 3 4 3 8 3 3
##  [815] 5 3 3 8 0 2 0 2 5 7 2 1 2 3 3 2 3 3 1 5 2 3 3 6 1 4 4 4 2 3 2 4 6 6 5 5 5
##  [852] 2 1 3 3 3 3 4 4 4 3 2 5 1 1 1 1 4 4 3 2 7 2 6 1 3 3 3 2 4 0 4 5 3 3 2 2 4
##  [889] 3 3 6 1 4 1 2 4 3 2 3 2 2 1 5 3 4 4 2 6 3 5 1 2 3 5 3 4 2 2 4 4 6 1 3 3 5
##  [926] 2 0 5 5 0 3 1 4 3 4 4 5 4 5 5 6 3 5 1 1 2 6 1 4 5 5 3 2 2 3 1 4 1 4 0 1 5
##  [963] 3 4 0 3 5 2 3 3 5 3 2 5 3 2 3 6 3 3 3 1 3 0 4 3 5 2 6 0 5 5 6 4 8 2 2 3 3
## [1000] 1
myoedu <- mean(yoedu)
myoedu
## [1] 2.996
sqrt(sum((yoedu - mean(yoedu))^2)/length(yoedu))
## [1] 1.675704
#vbhavya Peer comment: I like the way you named your variables. It's quite easy to keep track of. I use x,y and z repeatedly so it variables keep being rewritten and I sometimes can't use them again. Your way seems so intuitive but I didn't think of it. 

Question 2: Use {ggplot} to make boxplots of each of these variables by gender

library(ggplot2)

#height
h <- ggplot(data = d, aes(x = gender, y = height, color = factor(gender))) + geom_boxplot() + ylab("Height") #creates box plot of height and gender with colors based on gender and labels y axis
h

#weight
w <- ggplot(data = d, aes(x = gender, y = weight, color = factor(gender))) + geom_boxplot() + ylab("Weight")
w

#age
a <- ggplot(data = d, aes(x = gender, y = age, color = factor(gender))) + geom_boxplot() + ylab("Age")
a

#number of zombies killed
zn <- ggplot(data = d, aes(x = gender, y = zk, color = factor(gender))) + geom_boxplot() + ylab("Number of Zombies Killed")
zn

#years of education
ey <- ggplot(data = d, aes(x = gender, y = yoedu, color = factor(gender)))+ geom_boxplot() + ylab("Years of Education")
ey

#vbhavya Peer comments: 
# 1. I like how you did name each plot. Again, I'm often in such a rush that I forget to do that. It's a great practice. 
# 2. I don't actually think you need to do the multiple steps in ggplot to add details into a graph. I know that's how Chris did it in the modules and it's probably a good practice. But I wrote this code: p <- ggplot(data = d, aes(x = gender, y = age,
#color = factor(gender))) + geom_boxplot()
#p
#It still works. Just letting you know so you can choose the way you prefer. A part of learning how to code is figuring out which way you like to code. 
# 3. You might want to experiment with different themes or add colors to the graph. This isn't necessary but it helps with visualisation to have different colors (especially when you evetually make figures for reports or papers)

Question 4: Using histograms and Q-Q plots, check whether the quantitative variables seem to be drawn from a normal distribution. Which seem to be and which do not (hint: not all are drawn from the normal distribution)? For those that are not normal, can you determine from which common distribution they are drawn?

hist(height, probability = TRUE) #creates histogram using height data and comparing the probability

qqnorm(height, main = "Normal QQ plot random normal variables")  #creates qqnorm graph to test normal distribution
qqline(height, col = "gray") #create line that is the normal distribution

hist(weight, probability = TRUE)

qqnorm(weight, main = "Normal QQ plot random normal variables")
qqline(weight, col = "gray")

hist(age, probability = TRUE)

qqnorm(age, main = "Normal QQ plot random normal variables")
qqline(age, col = "gray")

hist(zk, probability = TRUE)

qqnorm(zk, main = "Normal QQ plot random normal variables")
qqline(zk, col = "gray")

hist(yoedu, probability = TRUE)

qqnorm(yoedu, main = "Normal QQ plot random normal variables")
qqline(yoedu, col = "gray")

#vbhavya Peer comment: I too had a really hard time figuring out what distribution the data were drawn from. To me, it seems Poisson (and I had to discuss with some of the other grad students to come to a conclusion). But it probably is poisson because if you look at the histogram, you see the distribution looks very similar to what a general Poisson looks like. I also googled a bit after I pushed the HW assignment and stumbled upon this https://stackoverflow.com/questions/31741742/how-to-identify-the-distribution-of-the-given-data-using-r where people share much better ways to figure out the distribution of a sample dataframe. I will give it a try for my final code and we can discuss it later if you'd like!

Height, age, and weight all seem to be normally distributed due to their histograms following a normal Gaussian bell curve, and their data following the normal qq line.

However, number of zombies killed and years of education are not normally distributed. Their histograms are left shifted and do not follow the normal Gaussian curve. They are possibly drawn to a poisson distribution. Poisson histograms can often be drawn to one side or the other due to their random nature.This is also seen in the disjointed nature of the data in the qq line graphs.

Question 5: Now use the sample() function to sample ONE subset of 30 zombie survivors (without replacement) from this population and calculate the mean and sample standard deviation for each variable. Also estimate the standard error for each variable, and construct the 95% confidence interval for each mean. Note that for the variables that are not drawn from the normal distribution, you may need to base your estimate of the CIs on slightly different code than for the normal…

#sample(d, 30, replace = FALSE)
#in this case the length of d is only 10 so this doesn't work

#height
hs <- sample(height, 30, replace = FALSE) #takes a random sample of 30 from the height dataset
hs#returns the sample
##  [1] 62.17699 67.67221 63.70855 65.71919 71.16252 75.43860 71.58093 68.70399
##  [9] 68.19738 68.40776 72.15195 69.24513 79.92265 65.21677 70.64534 60.74299
## [17] 71.62667 72.82977 63.23416 67.66987 59.43831 67.77419 67.62471 71.58885
## [25] 69.28553 69.87253 63.82403 64.61437 62.03725 68.16988
mhs <- mean(hs) #takes mean of the 30 samples
mhs
## [1] 68.00944
sdhs <- sd(hs) # takes standard deviation of the sample
sdhs
## [1] 4.472735
hsse <- sdhs/sqrt(30) #takes standard error of the 30 samples
hsse
## [1] 0.816606
lower <- mh - qnorm(1 - 0.05/2) * hsse #lower tail
upper <- mh + qnorm(1 - 0.05/2) * hsse #upper tail 
ci <- c(lower, upper) #calculates the confidence interval
ci
## [1] 66.02958 69.23062
#weight
ws <- sample(weight, 30, replace = FALSE)
ws
##  [1] 126.1780 125.6139 147.5891 133.4674 123.5098 142.0773 137.9209 128.6292
##  [9] 155.7343 146.7831 137.0140 157.9666 177.4089 167.5018 129.4849 148.5910
## [17] 137.1519 165.9423 116.9201 165.5350 154.5452 163.5918 142.6842 157.0922
## [25] 141.2987 143.3415 159.7062 150.5904 143.9200 143.9843
mws <- mean(ws)
mws
## [1] 145.7258
sdws <- sd(ws)
sdws
## [1] 14.81837
sews <- sdws/sqrt(30)
sews
## [1] 2.705452
lower <- mw - qnorm(1 - 0.05/2) * sews  
upper <- mw + qnorm(1 - 0.05/2) * sews 
ci <- c(lower, upper)
ci
## [1] 138.6049 149.2101
#age
as <- sample(age, 30, replace = FALSE)
as
##  [1] 21.35860 19.45614 22.37782 20.57065 23.84402 18.61007 20.43760 19.30345
##  [9] 22.34703 21.97010 23.83629 22.02548 21.90370 17.64006 21.21939 25.42632
## [17] 20.82915 16.32740 23.16894 20.70579 18.66627 15.33620 23.35168 17.71510
## [25] 17.63057 23.42488 20.81643 17.31055 18.53755 16.33405
mas <- mean(as)
mas
## [1] 20.41604
sdas <- sd(as)
sdas
## [1] 2.587571
seas <- sdas/sqrt(30)
seas
## [1] 0.4724236
lower <- ma - qnorm(1 - 0.05/2) * seas  
upper <- ma + qnorm(1 - 0.05/2) * seas 
ci <- c(lower, upper)
ci
## [1] 19.12103 20.97289

Both zombies killed and years of education did not have both normal distributions so that requires a different way to get their confidence intervals than the methods above.

#zombies killed
zks <- sample(zk, 30, replace = FALSE)
zks
##  [1] 1 0 3 6 3 4 2 5 1 2 2 1 2 3 4 4 2 1 0 2 0 7 2 2 1 4 1 5 7 3
mzks <- mean(zks)
mzks
## [1] 2.666667
sdzks <- sd(zks)
sdzks
## [1] 1.93575
sezks <- sdzks/sqrt(30)
sezks
## [1] 0.3534179
quantile(zks)
##   0%  25%  50%  75% 100% 
##    0    1    2    4    7
quantile(zks, c(0.025, 0.975)) #returns CI for a non-normal distribution, also known as bootstraping
##  2.5% 97.5% 
##     0     7
#years of education
edus <- sample(yoedu, 30, replace = FALSE)
edus
##  [1] 5 2 4 7 2 4 3 3 6 1 3 6 1 5 4 3 2 1 1 4 2 4 2 7 3 3 3 2 4 1
medus <- mean(edus)
sdedu <- sd(edus)
sdedu
## [1] 1.740657
seedu <- sdedu/sqrt(30)
seedu
## [1] 0.3177989
quantile(edus)
##   0%  25%  50%  75% 100% 
##    1    2    3    4    7
quantile(edus, c(0.025, 0.975)) #returns CI for a non-normal distribution 
##  2.5% 97.5% 
##     1     7
#vbhavya Peer comment: So, I did this very round about way in which I approximated the Poisson distributions to a normal distribution (you can do that by calculating population mean, which will be the lambda. Then, for a normal approximation of a poisson, you can do rnorm(n = 30, mean = lambda, sd = sqrt(lambda))). I only thought of this way because I learnt in one of my stats courses that distributions can be approximated to another distribution but I honestly don't know if what I've done is right. I only converted the poisson to a normal so I could proceed with the usual code for CI. 
#I think using a t-distribution to find the critical values might be a much better way. I don't see why it would be wrong. 
#One of my friends googled 'how to calculate the CIs for a poisson distribution sample' and that worked for them too. But you'd need to know that the sample is drawn from a Poisson for that. 

Question 6: Now draw 99 more random samples of 30 zombie apocalypse survivors, and calculate the mean for each variable for each of these samples. Together with the first sample you drew, you now have a set of 100 means for each variable (each based on 30 observations), which constitutes a sampling distribution for each variable. What are the means and standard deviations of this distribution of means for each variable?

#height
hs2 <- NULL  # sets up a dummy variable
n <- 30 #number of samples 
for (i in 1:99) {
    hs2[[i]] <- mean(sample(height, n, replace = FALSE))
} #draws 99 samples with 30 random numbers from height data set and takes the mean of each sample set
hs2 <- append(hs2, mhs, after = 99) #adds the mean from question 5 to the list
hs2 <- unlist(hs2) #unlist the variable
hs2
##   [1] 67.37055 68.11070 66.46042 67.34463 68.98181 66.66466 67.22918 67.85942
##   [9] 66.87669 66.61120 66.27082 68.35113 67.39410 68.04325 66.69883 68.11314
##  [17] 65.59631 68.25620 68.86638 67.90261 67.89133 67.78447 67.45981 68.31872
##  [25] 67.74945 66.94607 66.89717 68.16784 67.65970 67.63312 67.87056 67.25819
##  [33] 67.38314 66.67324 67.14668 67.94441 66.53616 68.65624 67.97029 67.58050
##  [41] 67.49940 66.71326 67.96461 69.10110 67.13290 66.83555 67.35922 67.09814
##  [49] 67.95785 67.41227 69.33841 66.57734 67.26578 68.44943 66.61389 68.77368
##  [57] 67.17551 67.86484 67.70289 67.03394 67.95836 67.79473 68.15513 68.73047
##  [65] 67.30457 67.16412 67.17188 66.95230 68.29139 66.43915 67.49613 67.40249
##  [73] 68.18094 66.33143 67.48091 68.40269 68.19561 67.65746 67.64477 67.13887
##  [81] 67.91175 67.52387 67.88691 67.38589 68.44245 66.35066 66.86538 68.24490
##  [89] 67.48597 66.67403 68.12573 69.00413 68.26019 67.76707 68.61866 67.51518
##  [97] 67.56882 67.00244 66.32495 68.00944
mean(hs2) # takes the mean
## [1] 67.57261
sd(hs2) #takes the standard deviation
## [1] 0.723499
#weight
ws2 <- NULL
for (i in 1:99) {
    ws2[[i]] <- mean(sample(weight, n, replace = FALSE))
}
ws2 <- append(ws2, mws, after = 99)
ws2 <- unlist(ws2)
ws2
##   [1] 149.2243 149.3426 144.4138 142.7077 141.8277 143.5151 144.6502 145.9599
##   [9] 139.6898 137.6104 144.6322 141.0080 143.5122 146.5877 140.3431 145.2238
##  [17] 144.2205 136.1247 145.0030 138.6951 148.2886 145.2744 144.6473 147.2054
##  [25] 141.3006 147.3195 149.2866 142.5798 153.3930 144.2856 144.4032 143.6901
##  [33] 141.7812 138.1472 144.1120 154.4070 148.6591 144.5287 145.2521 145.0948
##  [41] 144.7146 142.3885 140.5279 141.8275 151.2292 140.8284 148.1070 145.6162
##  [49] 143.2447 148.4902 141.9889 143.3131 146.7663 143.3645 145.8631 140.2739
##  [57] 148.3049 144.6771 142.5965 143.1197 142.1760 146.5549 145.3801 146.5210
##  [65] 145.1371 141.9495 147.8230 143.8800 144.8921 146.1448 144.4886 141.5276
##  [73] 142.4638 151.3277 144.9215 148.0499 146.8320 145.1195 142.9404 142.2902
##  [81] 143.1719 144.0654 145.5375 139.8939 144.0694 143.6667 143.3838 141.6026
##  [89] 141.4966 146.3459 142.4395 140.5767 147.3911 142.0815 142.5311 141.4649
##  [97] 141.0898 138.7399 145.2084 145.7258
mean(ws2)
## [1] 144.2609
sd(ws2)
## [1] 3.192132
#age
as2 <- NULL
for (i in 1:99) {
    as2[[i]] <- mean(sample(age, n, replace = FALSE))
}
as2 <- append(as2, mas, after = 99)
as2 <- unlist(as2)
as2
##   [1] 20.04497 20.05582 20.47526 19.60514 20.39740 19.85602 19.69394 19.79416
##   [9] 19.25818 20.92010 20.28502 20.09095 20.65606 20.20377 19.83953 19.88151
##  [17] 19.43559 19.99189 20.45109 20.02460 20.91039 21.42651 20.37084 20.34562
##  [25] 19.70716 19.17470 20.11638 19.93302 19.53281 19.72183 20.02415 21.08865
##  [33] 19.68329 19.68528 19.94181 19.94761 19.51473 20.08318 19.58368 20.89848
##  [41] 19.99048 20.38778 19.28217 19.72156 19.57890 19.69938 20.48205 19.63067
##  [49] 19.65704 20.08400 20.14658 20.61881 20.04924 19.34670 20.06856 20.60706
##  [57] 21.13012 20.15451 20.58894 19.59327 19.83026 19.69956 20.77993 19.82125
##  [65] 20.67311 19.81287 19.77761 20.41974 19.97043 19.93037 19.57648 20.34464
##  [73] 19.63206 20.82898 19.51555 19.18377 20.12811 20.39407 19.87020 19.92642
##  [81] 19.42859 21.57719 20.27932 19.10460 20.38844 18.88847 20.23658 19.67120
##  [89] 20.80550 20.40414 20.40952 19.66270 19.17273 19.97989 20.63190 20.45588
##  [97] 19.70025 20.01956 20.28604 20.41604
mean(as2)
## [1] 20.05103
sd(as2)
## [1] 0.5121896
#zombies killed
zks2 <- NULL
for (i in 1:99) {
    zks2[[i]] <- mean(sample(zk, n, replace = FALSE))
}
zks2 <- append(zks2, mzks, after = 99) #adds the mean from the sample in question 5 
zks2 <- unlist(zks2)
zks2
##   [1] 2.900000 2.766667 3.466667 2.633333 2.866667 2.600000 2.800000 3.066667
##   [9] 3.166667 2.666667 3.066667 3.133333 3.366667 3.166667 3.166667 3.066667
##  [17] 2.633333 2.366667 3.166667 2.800000 3.166667 3.133333 2.866667 3.133333
##  [25] 2.700000 3.266667 3.066667 3.233333 2.666667 2.933333 2.966667 2.633333
##  [33] 2.900000 3.633333 3.633333 3.300000 2.900000 3.100000 3.033333 3.133333
##  [41] 2.833333 3.066667 3.200000 2.833333 3.066667 3.100000 2.633333 2.666667
##  [49] 3.266667 3.233333 3.400000 3.400000 2.966667 2.800000 3.233333 3.166667
##  [57] 2.733333 3.166667 3.033333 3.000000 3.233333 2.566667 3.533333 3.200000
##  [65] 2.866667 2.700000 2.933333 2.833333 3.233333 3.066667 3.366667 3.100000
##  [73] 3.033333 2.966667 2.866667 2.500000 2.966667 3.300000 3.000000 2.966667
##  [81] 3.100000 2.833333 3.066667 2.333333 3.133333 3.033333 2.866667 2.566667
##  [89] 3.133333 2.700000 2.800000 3.333333 2.800000 3.033333 3.166667 3.000000
##  [97] 3.000000 3.366667 2.833333 2.666667
mean(zks2)
## [1] 3.000667
sd(zks2)
## [1] 0.260233
#years of education
yedus2 <- NULL
for (i in 1:99) {
    yedus2[[i]] <- mean(sample(yoedu, n, replace = FALSE))
}
yedus2 <- append(yedus2, medus, after = 99)
yedus2 <- unlist(yedus2)
yedus2
##   [1] 2.833333 3.000000 3.633333 3.166667 3.333333 2.866667 2.733333 2.633333
##   [9] 3.000000 3.033333 3.133333 3.100000 2.400000 2.400000 3.000000 3.066667
##  [17] 3.433333 3.233333 2.600000 2.833333 2.933333 2.933333 2.833333 3.433333
##  [25] 3.266667 2.866667 2.400000 2.966667 3.033333 2.900000 3.066667 2.833333
##  [33] 3.100000 3.300000 3.500000 3.066667 2.166667 3.200000 3.133333 3.133333
##  [41] 2.800000 2.800000 2.666667 2.500000 2.533333 3.133333 3.133333 2.500000
##  [49] 3.166667 3.300000 2.933333 2.900000 2.900000 2.900000 2.300000 2.966667
##  [57] 2.600000 3.000000 3.166667 2.966667 3.166667 2.566667 3.166667 2.566667
##  [65] 3.766667 2.800000 3.200000 3.200000 2.700000 2.966667 2.900000 2.800000
##  [73] 2.833333 3.000000 3.066667 2.966667 2.700000 2.133333 2.766667 2.833333
##  [81] 2.266667 3.033333 3.333333 3.133333 3.333333 3.533333 3.000000 2.766667
##  [89] 3.133333 2.933333 3.200000 2.866667 2.633333 2.666667 3.300000 2.866667
##  [97] 2.833333 2.733333 2.966667 3.266667
mean(yedus2)
## [1] 2.945667
sd(yedus2)
## [1] 0.3057861

How do the standard deviations of means compare to the standard errors estimated in [5]?

All of the SEs from question 5were higher than the SDs. For example height SE was 0.8527719 and the SD of the means was 0.7719534.

What do these sampling distributions look like (a graph might help here)? Are they normally distributed? What about for those variables that you concluded were not originally drawn from a normal distribution?

#height
hist(hs2, probability = TRUE) #create histogram from sample distribution calculated in chunk above

qqnorm(hs2, main = "Normal QQ plot random normal variables")  #plots qqnorm graph based of hs2 data
qqline(hs2, col = "gray") #plot qqline 

#weight
hist(ws2, probability = TRUE)

qqnorm(ws2, main = "Normal QQ plot random normal variables")
qqline(ws2, col = "gray")

#age
hist(as2, probability = TRUE)

qqnorm(as2, main = "Normal QQ plot random normal variables")
qqline(as2, col = "gray")

#number of zombies killed
hist(zks2, probability = TRUE)

qqnorm(zks2, main = "Normal QQ plot random normal variables")
qqline(zks2, col = "gray")

#years of education
hist(yedus2, probability = TRUE)

qqnorm(yedus2, main = "Normal QQ plot random normal variables")
qqline(yedus2, col = "gray")

#vbhavya Peer comment: I love that you checked using the qqnorm() function! Very thorough!

Most of the variables are normally distributed, of course this is a little variation like in the number of zombies killed. There is more variation in adherence to the qqnorm line as there was in the original population. As well, because these samples are randomly generated the histograms are not a perfectly normal Guassian distribtion. Compared to the original histograms of the population the qqline graph seem to follow the line more for years of education and number of zombies killed, which were originally not normally distributed.

Challenges Faced

  1. Figuring out the formula to calculate standard deviation was hard for me to find and figure out how to use. But once I found it in the modules it was pretty straightforward.

  2. Initially both of my ggplot scatter plots would not run and I could not figure out what was going wrong. After 30 minutes of reinstalling r studio and restarting my computer I figured out that I was just simply missing a ‘)’

  3. Figuring out the difference between standard error and standard deviation is something I still don’t understand but I think my code is calculating the right numbers

  4. I could not figure out how to take a sample from my data set d because its length was only 10 so I eventually came to the conclusion that I had to take samples from each of the variable columns I would be looking at.

  5. I worked on trying to get 99 samples of size 30 for so long. But in the end and after staring at my code for many hours I took samples of each variable in a for loop